﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace CSF.JobNotifier.Service
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“IJobNotifyService”。
    [ServiceContract]
    public interface IJobNotifyService
    {
        [OperationContract]
        WorkProcessMessage[] GetWorkProcess(string ticket);

        [OperationContract]
        JobNotifyMessage GetNextJob(string ticket,int no);

        [OperationContract]
        JobMessage[] GetProcessingJobs(string ticket, bool all);

        [OperationContract]
        int SetProcessJob(string ticket, string jobNo, string itemCode, string qulity, string gP1, bool isUrgent, string comment);

        [OperationContract]
        void FinishByJonNo(string jobNo);
        
        [OperationContract]
        List<NotFinishJobMessage> GetAllNotFinishMessage();

        [OperationContract]
        List<NotFinishJobMessage> GetNotFinishByUser(string ticket);
    }

    [DataContract]
    public class WorkProcessMessage
    {
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string Code { get; set; }

        [DataMember]
        public string Name { get; set; }

        [DataMember]
        public string Color { get; set; }
    }

    [DataContract]
    public class JobNotifyMessage
    {
        [DataMember]
        public int TotalJobCount { get; set; }

        [DataMember]
        public int MyJobCount { get; set; }

        [DataMember]
        public string JobNo { get; set; }

        [DataMember]
        public int[] FinishedProcessId { get; set; }

        [DataMember]
        public string ItemCode { set; get; }

        [DataMember]
        public int? ItemQty { set; get; }
    }

    [DataContract]
    public class JobMessage
    {
        [DataMember]
        public string JobNo { get; set; }

        [DataMember]
        public int[] FinishedProcessId { get; set; }
    }

    [DataContract]
    public class NotFinishJobMessage
    {
        [DataMember]
        public string JobNo { set; get; }
        [DataMember]
        public string Step1 { set; get; }
        [DataMember]
        public string Step2 { set; get; }
        [DataMember]
        public string Step3 { set; get; }
        [DataMember]
        public string Step4 { set; get; }
        [DataMember]
        public string Step5 { set; get; }
        [DataMember]
        public string ItemCode { set; get; }
        [DataMember]
        public int? Quanlity { set; get; }
        [DataMember]
        public string Comment { set; get; }
        [DataMember]
        public string GP1 { set; get; }
        [DataMember]
        public bool? IsUrgent { set; get; }


    }
}
